package com.ruoyi.robot.controller;

/**
 * 功能描述：
 *
 * @Author：yid
 * @Date：2023/4/17 23:41
 */

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.robot.pojo.po.RobotMes;
import com.ruoyi.robot.pojo.po.RobotParameter;
import com.ruoyi.robot.service.RobotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = "机器人信息接口")
@RestController
@RequestMapping("/robot/robotParameter")
public class RobotParameterController extends BaseController {

    private final RobotService robotService;

    @Autowired
    public RobotParameterController(RobotService robotService) {
        this.robotService = robotService;
    }


    /**
     * 新增机器人坐标、清洁度等级
     */
    @ApiOperation("新增机器人坐标、清洁度等级")
    @PostMapping("/{robotNo}/addCoordinates")
    public AjaxResult addCoordinates(@Validated @RequestBody RobotMes robotMes) {
        return robotService.addCordinates(robotMes);
    }

    /**
     * 查询机器人坐标、清洁度等级列表
     */
    @ApiOperation("查询机器人坐标、清洁度等级")
    @GetMapping("/selectCoordinates")
    public AjaxResult selectCoordinates(String robotNo, Long start, Long end) {
        return robotService.selectCordinates(robotNo, start, end);
    }

    /**
     * 新增机器人物联网数据
     */
    @ApiOperation("新增机器人物联网数据")
    @PostMapping("/addRobotParameter/{robotNo}")
    public AjaxResult addRobotParameter2(@Validated @RequestBody RobotParameter robotParameter, @PathVariable String robotNo) {
        robotParameter.setRobotNo(robotNo);
        return robotService.addRobotParameter(robotParameter);
    }

    /**
     * 查询机器人物联网数据
     */
    @ApiOperation("查询机器人物联网数据")
    @GetMapping("/selectRobotParameter")
    public AjaxResult selectRobotParameter(String robotNo, Long start, Long end) {
        return robotService.selectRobotParameter(robotNo, start, end);
    }
}

